<template>
  <div class="pager">
    <el-pagination background
                   :current-page.sync="currentPage"
                   layout="prev, pager, next, total, slot"
                   :page-size="pageSize"
                   :total="total"
                   @current-change="changePage">
      <span class="pigeSize">每页{{pageSize}}条</span>
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 0,
    },
    pageSize: {
      type: Number,
      default: 0,
    },
  },
  data () {
    return {
      // 当前页，每次点击查询按钮需初始化查询页
      currentPage: 1,
    };
  },
  methods: {
    changePage (current) {
      this.$emit('page-change', current);
    },
  },
};
</script>

<style lang="less" scoped>
.pager {
  text-align: right;
  margin-top: 20px;
  .pigeSize {
    font-weight: normal;
  }
}
</style>
